using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using XDL.Framework.Configuration;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace XDL.Framework.Graphics
{
    /// <summary>
    /// Stores the definition of a light source.
    /// </summary>
    public class LightInformation
    {
        /// <summary>
        /// Light name
        /// </summary>
        public readonly string Name;

        /// <summary>
        /// Light position
        /// </summary>
        public readonly Vector3 Position;
        /// <summary>
        /// Light color
        /// </summary>
        public readonly Color Color;

        /// <summary>
        /// Light intensity.
        /// </summary>
        public readonly float Energy;

        /// <summary>
        /// Creates a new instance with the information from the XML stream.
        /// </summary>
        /// <param name="xd">XML node</param>
        public LightInformation(XmlNode xd)
        {
            // <Light name="Spot" type="1" position="48.049877;11.313890;11.313890" color="1.000000;1.000000;1.000000" energy="1.000000"/>
            this.Name = xd.Attributes["name"].Value;
            this.Position = XmlHelper.ReadXmlVector<Vector3>(xd.Attributes["position"].Value);
            this.Color = new Color(XmlHelper.ReadXmlVector<Vector3>(xd.Attributes["color"].Value));
            this.Energy = XmlHelper.ReadXmlFloat(xd.Attributes["energy"].Value);
        }
    }
}
